// user.entity.ts
import { EntityBasis } from 'src/common/database/EntityBasis';
import { Column, Entity, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import * as faker from 'faker';
import { Yingpingfankui } from 'src/admin/yingpingfankui/entities/yingpingfankui.entity';

@Entity('user')
export class UserEntity extends EntityBasis {
  /** 主键唯一id */
  @PrimaryGeneratedColumn()
  id: number;

  /** 用户名 */
  @Column({ type: 'text', nullable: true })
  username: string = faker.name.findName();

  /** 密码 */
  @Column({ type: 'text', nullable: true })
  password: string;

  /** 头像 */
  @Column({ type: 'text', nullable: true })
  avatar_url: string = 'default.jpg';

  /** 用户的所有课程反馈（一对多关系） */
  @OneToMany(() => Yingpingfankui, (feedback) => feedback.user)
  feedbacks: Yingpingfankui[];
}
